package edu.kjxy.day03.synBlockString2;

/**
 * 功能:
 * 作者:程序员欧阳子韩
 * 日期:2024/2/2 19:03
 */
public class Service {
    private String anyString = new String();
    public void a(){
        try {
            synchronized (anyString){
                System.out.println("a begin");
                Thread.sleep(3000);
                System.out.println("a end");
            }
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
    synchronized public void b(){
        System.out.println("b begin");
        System.out.println("b end");
    }
}
